package com.example.problem2.controller;

import com.example.problem2.api.IDemoService;
import com.example.problem2.bean.DemoBean;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("demoController")
public class DemoController {

    @Autowired
    private IDemoService demoService;

    @RequestMapping("resultJson")
    public List<DemoBean> resultJson() {
        return demoService.queryDemoAll();
    }
    @RequestMapping("resultXml")
    public DemoBean resultXml() {
        DemoBean demoBean = new DemoBean();
        demoBean.setId("10000");
        demoBean.setValue("返回demoBean的XML格式数据");
        return demoBean;
    }
}
